package life.cqq.jwt.controller;/**
 * Created by Kim QQ.Cong on 2022/7/8 / 13:22
 *
 * @author: CongQingquan
 * @Description:
 */

import life.cqq.jwt.entity.User;
import life.cqq.jwt.util.JwsUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class TestController {

    @GetMapping("/checkToken")
    public String checkToken(String token) {
        return JwsUtils.valid(token) ? "无效" : "有效";
    }

    @GetMapping("/getToken")
    public String getToken(String account, String name) {
        return JwsUtils.generateToken(User.builder().account(account).name(name).build());
    }
}